//创建路由实例
import { createRouter, createWebHistory } from 'vue-router'
import Login from '@/views/Login/index.vue'
import Layout from '@/views/Layout/index.vue'
import Home from '@/views/Home/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  //配置 path 和 Component 对应关系的位置
  routes: [
    {
      path: '/',
      component: Layout,
      children: [
        {
          //路径为空字符串,代表渲染 Layout 时默认会访问这个二级路由(默认二级路由)
          path : '',
          component : Home
        },
      ]
    },
    {
      path: '/login',
      component: Login,
    },
  ],
})

export default router
